export default {
  data() {
    return {
      flag: false,
    }
  },
  computed: {
    activeRow() {
      return this.$store.state.publics.activeRow
    },
    taskRow() {
      return this.$store.state.spiderTask.taskRow
    },
  },
  watch: {
    activeRow: {
      immediate: true,
      handler(row) {
        this.init(row)
      },
    },
  },
  mounted() {
    this.flag = this.activeRow.hasOwnProperty('id')
  },
  methods: {
    //验证form必填
    validateForm(callback, type) {
      this.$refs['form'].validate(async (valid) => {
        if (valid) {
          let ruleVO =
            type != 'step01'
              ? Object.assign(this.taskRow.ruleVO, this.form)
              : ''
          let obj = type == 'step01' ? this.form : { ruleVO }
          this.$store.commit('SET_TASKROW', obj)
          callback()
        }
      })
    },
  },
}
